GBML manual / Constants

EASE_BACK_IN

Pulls back a little before it sets off, like drawing a bow before the arrow flies. The number goes about 10% the wrong way first, so it leaves the range from the start to the end.

Syntax

EASE_BACK_IN: constant

Description

The "back in" curve for tween and tween_to: it pulls back before it goes, the way you draw a bow back before the arrow flies. The number first goes a little the wrong way, then speeds up and arrives at full speed. After a quarter of the time it is at -0.06 (a little behind the start), after half at -0.09, and only after three quarters is it clearly on its way: 0.18.

The number leaves the range

Most curves keep the number between from and to. This one does not. For a moment the number goes about 10% of the distance behind from, the wrong way: a number tweened from 100 to 200 dips to about 90 before it climbs to 200, and something moving to the right slides a little to the left first.

When the number is a position, that is the whole point: it is what makes a move feel like it has weight. When the number has to stay in a range it is a problem. A health that is tweened up with this curve dips below where it started, and a volume dips below its quietest:

tween_to(hp, 100, 60, EASE_BACK_IN);   // hp drops below its start first: don't do this to a number with limits

For a number that must stay between its two ends, use a sine or quad curve, or a bounce, which never goes outside them. It does arrive exactly: after the end the number is exactly to, every frame.

A real capture, 27 frames played in a loop - three small graphs, one above the other, labeled in, out and in out. In each one a ball moves steadily to the right while its height on the screen is the number being tweened: a dim dashed line at the top is where the number starts, a green dashed line below it is where it ends, and a trail of dots shows where the ball has been. In the out row the ball sinks a little past the green line and then comes back up onto it. In the in row it first rises a little above the dim line, the wrong way, and then sinks down to the green line. The in out row does both. The first frame, which is all a viewer that cannot animate shows, is the finished picture: every dot, drawing the whole of each curve.A real capture, 27 frames played in a loop - three small graphs, one above the other, labeled in, out and in out. In each one a ball moves steadily to the right while its height on the screen is the number being tweened: a dim dashed line at the top is where the number starts, a green dashed line below it is where it ends, and a trail of dots shows where the ball has been. In the out row the ball sinks a little past the green line and then comes back up onto it. In the in row it first rises a little above the dim line, the wrong way, and then sinks down to the green line. The in out row does both. The first frame, which is all a viewer that cannot animate shows, is the finished picture: every dot, drawing the whole of each curve.
A real capture, 27 frames played in a loop - three small graphs, one above the other, labeled in, out and in out. In each one a ball moves steadily to the right while its height on the screen is the number being tweened: a dim dashed line at the top is where the number starts, a green dashed line below it is where it ends, and a trail of dots shows where the ball has been. In the out row the ball sinks a little past the green line and then comes back up onto it. In the in row it first rises a little above the dim line, the wrong way, and then sinks down to the green line. The in out row does both. The first frame, which is all a viewer that cannot animate shows, is the finished picture: every dot, drawing the whole of each curve.

The same tween three ways, one row for each of EASE_BACK_IN, EASE_BACK_OUT and EASE_BACK_IN_OUT. The ball's height is the number (like tween_to(y, ...) moving something down), and it drifts right at a steady speed only so that the shape can be seen. The dim line is where the number starts and the green line is where it ends: look for the ball going past the green line, or behind the dim one. Real pictures from a Game Boy Advance ROM, 4 frames apart, played at the speed of the console. A viewer that does not animate shows the first picture, the finished one.

Example

tween_to(x, x + 100, 50, EASE_BACK_IN);

The walker slides about 10 pixels to the left first (a tenth of the 100 it is going to travel), then speeds off to the right and arrives exactly 100 pixels from where it began.

Good for a move that should feel wound up: a button that dips before it pops out, a character that crouches before a jump, a bow drawn before it fires. EASE_BACK_OUT is the same thing at the other end.

See also: tweentween_totween_from_to